#pragma once

#include <pimstore.h>
#include "EdbData.h"

class PoomData
{
public:
  static bool Initialize(HWND hWindow);
  static void Terminate();

  static bool SubscribeToNotifications(OlDefaultFolders olFolder, UINT uiNotificationsType = PIMFOLDERNOTIFICATION_ALL);

  static IPOutlookApp2* GetApp()
  { return polApp; }

  static bool CreateContact(const TCHAR* szName = NULL, const TCHAR* szNumber = NULL);
  static bool DeleteContact(CEOID oId);

  static bool GetItemProperties(IItem* pItem, const CEPROPID* aPropIds, int nPropIds, PropertyValues& vals)
  { return GetItemProperties(pItem, aPropIds, nPropIds, &vals.pPropVals, vals.nPropVals); }
  static bool GetItemProperty(IItem* pItem, CEPROPID propId, PropertyValues& vals)
  { return GetItemProperty(pItem, propId, &vals.pPropVals, vals.nPropVals); }

  static bool SetItemProperties(IItem* pItem, PropertyValues& vals)
  { return SetItemProperties(pItem, vals.pPropVals, (WORD)vals.nPropVals); }
  static bool SetItemProperty(IItem* pItem, CEPROPVAL& pPropVal);

private:
  static bool GetItemProperties(IItem* pItem, const CEPROPID* aPropIds, int nPropIds, CEPROPVAL** pPropVals, ULONG& nPropValsSize);
  static bool GetItemProperty(IItem* pItem, CEPROPID propId, CEPROPVAL** pPropVal, ULONG& nPropValSize);
  static bool SetItemProperties(IItem* pItem, CEPROPVAL* pPropVals, WORD nPropVals);

private:
  static HWND           hWnd;
  static IPOutlookApp2* polApp;
};